// @import './theme2/mixins.scss';

@mixin position-abs($l: 0, $t: 0, $r: 0, $b: 0) {
  position: absolute;
  left: $l;
  top: $t;
  right: $r;
  bottom: $b;
}

/* flex
-------------------------- */
@mixin flex-x($y: initial, $x: initial) {
  display: flex;
  justify-content: $x;
  align-items: $y;
  overflow: hidden;
}

@mixin flex-y($x: initial, $y: initial) {
  display: flex;
  flex-direction: column;
  align-items: $x;
  justify-content: $y;
  overflow: hidden;
}

@mixin flex-1 {
  flex: 1;
  overflow: hidden;
}

/* text
-------------------------- */
$animationTime: 0.2s;
$animationType: linear;
$ratio: 750 / 10;

@function px2rem($px) {
  @return $px / $ratio + rem;
}

@mixin absCenter {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
}

@mixin center {
  display: flex;
  justify-content: center;
  align-items: center;
}

@mixin left {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

@mixin top {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

@mixin right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

@mixin columnTop {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

@mixin columnLeft {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

@mixin columnCenter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

@mixin ellipsis {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

@mixin ellipsis2($line) {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: $line;
}

@mixin scroll {
  overflow-x: hidden;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  &::-webkit-scrollbar {
    display: none;
  }
}

@mixin leftBottom {
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
}

@mixin text-clamp($clamp: 1) {
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-all;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: $clamp;
  overflow: hidden;
  line-height: normal;
}

.icon {
  color: #666;
  font-size: px2rem(16);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  border-radius: 0px !important;
  background-color: #f2f2f2;
}
::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
  min-height: 28px;
  border-radius: 0px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: #a8a8a8;
}
.el-time-panel__footer {
  display: flex;
  justify-content: flex-end;
}
.full_width {
  width: 100%;
}
.half_width {
  width: 50%;
}
.full_height {
  height: 100%;
}
.f-r {
  float: right;
}

// 使用示例 h10 代表高度10, w10
// height 10~100 px
@for $i from 10 through 100 {
  .h#{$i} {
    height: #{$i}px !important;
  }
}
// width 10~300 px
@for $i from 10 through 300 {
  .w#{$i} {
    width: #{$i}px !important;
  }
}
// border-radius 1~20 px
@for $i from 1 through 20 {
  .r#{$i} {
    border-radius: #{$i}px !important;
  }
}
// font-size 10~100 px
@for $i from 10 through 100 {
  .f#{$i} {
    font-size: #{$i}px !important;
  }
}

// margin/padding 0~100 px
@for $i from 0 through 100 {
  .m#{$i} {
    margin: #{$i}px !important;
  }
  .p#{$i} {
    padding: #{$i}px !important;
  }
}

// margin/padding-[direction] 0~100 px
@for $i from 0 through 100 {
  .mt#{$i} {
    margin-top: #{$i}px !important;
  }
  .mr#{$i} {
    margin-right: #{$i}px !important;
  }
  .mb#{$i} {
    margin-bottom: #{$i}px !important;
  }
  .ml#{$i} {
    margin-left: #{$i}px !important;
  }
  .pt#{$i} {
    padding-top: #{$i}px !important;
  }
  .pr#{$i} {
    padding-right: #{$i}px !important;
  }
  .pb#{$i} {
    padding-bottom: #{$i}px !important;
  }
  .pl#{$i} {
    padding-left: #{$i}px !important;
  }
}

// 字体间距
@for $i from 1 to 20 {
  .lb-#{$i} {
    letter-spacing: #{$i}px;
  }
}

// 字体行高
@for $i from 1 to 100 {
  .lh-#{$i} {
    line-height: #{$i}px;
  }
}

// 文本限制行数(防止文本溢出)
.ellipsis-1 {
  //单独写一个是为了编辑器能提示
  @include text-clamp(1);
}

// for循环2-5行限制
@for $i from 2 through 5 {
  .ellipsis-#{$i} {
    @include text-clamp($i);
  }
}

// flex布局
.flex,
.flex-column {
  display: flex;

  &.inline {
    display: inline-flex;
  }

  //折行
  &.flex-nowrap {
    flex-wrap: nowrap;
  }
  &.flex-wrap {
    flex-wrap: wrap;
  }
  &.flex-wrap-reverse {
    flex-wrap: wrap-reverse;
  }
  //横向对齐方式
  &.row-left {
    justify-content: flex-start;
  }
  &.row-right {
    justify-content: flex-end;
  }
  &.row-center {
    justify-content: center;
  }
  &.row-between {
    justify-content: space-between;
  }
  &.row-around {
    justify-content: space-around;
  }
  //纵向对齐方式
  &.col-top {
    align-items: flex-start;
  }
  &.col-bottom {
    align-items: flex-end;
  }
  &.col-center {
    align-items: center;
  }
  &.col-baseline {
    align-items: baseline;
  }
  &.col-stretch {
    align-items: stretch;
  }

  // 纵向flex
  &.flex-column {
    flex-direction: column;
    //横向对齐方式
    &.row-center {
      align-items: center;
    }
    &.row-left {
      align-items: flex-start;
    }
    &.row-right {
      align-items: flex-end;
    }
    &.row-between {
      align-items: stretch;
    }
    &.col-center {
      justify-content: center;
    }
    &.col-top {
      justify-content: flex-start;
    }
    &.col-bottom {
      justify-content: flex-end;
    }
  }
}

// flex 占比
@for $i from 0 through 24 {
  .flex-#{$i} {
    flex: $i;
  }
}

// flex居中
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}
// 字体
.f-bold {
  font-weight: 600;
}

// 字体颜色
.f-white {
  color: #ffffff;
}

.bg-white {
  background: #ffffff;
}

// 统一颜色
$green: #57bb72;
$purple: #b2a7fe;
$red: #e93232;
$orange: #eb932f;
$blue: #2878ff; //#228ffa #2055d3
